var search_submit = document.querySelector("#search-submit")



search_submit.onclick = function(){
    var output  = document.querySelector("#output")
    output.innerHTML = "<h3>正在扫描中，请稍后.....</h3><div class='loadingFive'><span></span><span></span><span></span><span></span><span></span></div>"
    var content_value = document.querySelector("#search-content").value
    axios({
        method:"POST",
        url:"http://192.168.2.154:8000/normalsearch/tcp",
        data: {
            ip: content_value,
            port: '',
            param: '-sS'
          }
    }).then(response=>{
        let output = document.querySelector("#output")
        
        console.log(response.data)
        var ipadd = Object.keys(response.data.scan)
        var host_name = response["data"]["scan"][ipadd[0]]["hostnames"][0]["name"]
        output.innerHTML = "<ul>扫描的ip地址是： "+ipadd+"<li>主机名称为："+host_name+"</li></ul>"
    }).catch(err=>{
        output.innerHTML=err
    })
}